import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)


const state = {
    initScreenData: null,
    SelectModuleData: null,
    SystemEvent: null
}
const actions = {
    // 接收消息并发送给webSocket
    SEND_PARAMS: (state, val) => {
        console.log('SEND函数接收到的消息', state, val);
    }
}
const mutations = {
    // 初始化屏幕
    INIT_SCREEN: (state, val) => {
        state.initScreenData = val
    },
    // 选中模块
    SELECT_MODULE: (state, val) => {
        console.log('store,选中模块', state, val);
        state.SelectModuleData = val
    },
    // 取消选中模块
    CANCEL_MODULE: (state, val) => {
        console.log('store,取消选中模块', state, val);
        state.SelectModuleData = val
    },
    // 下发事件
    ISSUED_EVENT: (state, val) => {
        console.log('收到系统事件', state, val);
        state.SystemEvent = val
    }
}
const store = new Vuex.Store({
    state,
    actions,
    mutations
})
export default store